<extend name="Public/base"/>

<block name="body">
	<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
	
	
	<div class="clear"></div>
	<div id="main">

		
      
	<div id="could_web" style="display:block;">
	<div id="advertisement" class="product1" style="display:block;">
						<div class="adver_form">

							


						</div><!--结束于广告设置-->


						<div id="team" style="display:block" class="product1" >
						<div class="case_head">
							<input class="set_head4 btn_color" type="button" value="添加团队图片">
							<input type="button" class="set_head4" value="管理团队图片">
						</div>
						<div class="case_form set4 " style="display:block;">
							<div class="tab-content">
								<form action="{:U('Team/addAction')}" method="post" class="form-horizontal">
								
							
									<div >
										<div class="form-item">
												<b>标题:</b>
												<input type="text" name="title" value="{$info.title|default=''}" placeholder="标题不能为空" >
										</div>
										<div class="form-item">
												<b>排序:</b>
												<input type="text" name="tid"  value="{$info.title|default=''}" height="50" placeholder="数字越小越靠前">
										</div>
							
										<div class="form-item">
											<label class="item-label">
												图片描述：<span class="check-tips"></span>
											</label>
											<textarea rows="5"  name="text" id="textc"></textarea>
											
										</div>
							
										<div class="form-item">
											
											<input type="file" id="upload_picture">
											<input type="hidden" name="icon" id="icon" value="{$info['icon']|default=''}"/>
											<div class="upload-img-box">
											<notempty name="info['icon']">
												
											</notempty>
											</div>
										</div>
							
							
										<script type="text/javascript">
										//上传图片
									    /* 初始化上传插件 */
										$("#upload_picture").uploadify({
									        "height"          : 30,
									        "swf"             : "__STATIC__/uploadify/uploadify.swf",
									        "fileObjName"     : "download",
									        "buttonText"      : "上传图片",
									        "uploader"        : "{:U('Team/uploadPicture',array('session_id'=>session_id()))}",
									        "width"           : 120,
									        'removeTimeout'	  : 1,
									        'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
									        "onUploadSuccess" : uploadPicture,
									        'onFallback' : function() {
									            alert('未检测到兼容版本的Flash.');
									        }
									    });
							
							
							
										function uploadPicture(file, data){
									    	var data = $.parseJSON(data);
									    	var src = '';
									        if(data.status){
									        	$("#icon").val(data.id);
									        	src = data.url || '__ROOT__' + data.path;
									        	$("#icon").parent().find('.upload-img-box').html(
									        		'<div class="upload-pre-item"><img src="' + src + '"/></div>'
									        	);
									        } else {
									        	updateAlert(data.info);
									        	setTimeout(function(){
									                $('#top-alert').find('button').click();
									                $(that).removeClass('disabled').prop('disabled',false);
									            },1500);
									        }
									    }
										</script>
									</div>
									
									<div class="form-item">
										
										<button type="submit" class="but" >
										确 定
										</button>
										<!-- <a href="#"></a> -->
									</div>
							
								</form>
							</div> 

						</div>
						<div id="team_control" class="set4">
							<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;团队照片管理</p>
							<div id="team_border">
								<p><input type="button" value="批量删除" id="c_url" add_url="{:U('Team/delta')}" onclick="delt()"></p>
                                <div class="team_t">
								<div id="team_tab">
									<p>全选</p>
									<p>团队图片</p>
									<p>标题</p>
									<p>排序</p>
									<p>操作</p>
								</div>
								<table id="team_table">
									<volist name="arr" id="v">
									<tr>
										<td>
											<input type="checkbox" value="{$v.id}" name="check" >
										</td>
										<td>
											<img src="__ROOT__/{$v.path}" width="50" height="50">
										</td>

										<td>{$v.title}</td>
										<td>{$v.tid}</td>
										<td>
											<a href="#"  onclick="return del(this) " date_url="{:U('Team/del')}" k_id="<?php echo $v['id']?>" class=" btn-danger search-query btn-mini">删除</a>
											<a href="{:U('Team/edit',array('id'=>$v['id']))}" class=" btn-info search-query btn-mini">编辑</a>
										</td>
									</tr>
								</volist>
								</table>
                                </div>
							</div>
						</div>	
        <div id="tuiguang">
			<div class="xinlang product1">
				<p> ！</p>
			</div>
			<div class="baidu product1">
				<p> </p>
			</div>
			<div class="luntan product1">
				<p> </p>
			</div>
		</div>

				</div>


        <div id="tuiguang">
			<div class="xinlang product1">
				<p> ！</p>
			</div>
			<div class="baidu product1">
				<p> </p>
			</div>
			<div class="luntan product1">
				<p> </p>
			</div>
		</div>
</div>

</block>


<block name="script">
	<script type="text/javascript">
	
	function delt(){
		var check = document.getElementsByName("check");
		var len = check.length;

		var c_url = $('#c_url').attr('add_url');
		console.log(c_url); 

		var idAll="";
		for (var i = 0; i < len; i++) {
			if(check[i].checked){
				idAll+=check[i].value+",";

			}
		}

		$.ajax({
			type:'get',
    		url:c_url,
    		data:'u_id='+idAll,
    		dataType:'json',
    		success:function(date){
    			alert(date.msg);
    			document.location.reload();
    		}
    	});

		console.log(idAll);
	}







		function del(obj){
	    	
	    	var k_id = $(obj).attr("k_id");
	    	// console.log(k_id);
	    	var url = $(obj).attr('date_url');
	    	// alert($(obj).attr("date_url")); 
	    	console.log($(obj).parent().parent());

	    	return;

	    	$.ajax({
	    		type:'get',
	    		url:url,
	    		data:'k_id='+k_id,
	    		dataType:'json',
	    		success:function(date){
	    			alert(date.msg);
	    			document.location.reload();
	    		}

	    	})

	    	return false;
	    }



		<present name="info.id">
		Think.setValue("allow_publish", {$info.allow_publish|default=1});
		Think.setValue("check", {$info.check|default=0});
		Think.setValue("model[]", {$info.model|json_encode} || [1]);
		Think.setValue("type[]", {$info.type|json_encode} || [2]);
		Think.setValue("display", {$info.display|default=1});
		Think.setValue("reply", {$info.reply|default=0});
		Think.setValue("reply_model[]", {$info.reply_model|json_encode} || [1]);
		</present>

		$(function(){
			showTab();
			$("input[name=reply]").change(function(){
				var $reply = $(".form-item.reply");
				parseInt(this.value) ? $reply.show() : $reply.hide();
			}).filter(":checked").change();
		});
		//导航高亮
		highlight_subnav('{:U('Team/index')}');
	</script>
</block>

